﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using ERMap;
namespace PhoneBook.Manage
{
    public class SysUserRole
    {
        public static Hashtable getuserrole(string userid)
        {
            Hashtable param = new Hashtable();
            param["userid"] = userid;

            return ERMapHelper.getmodel("SysUserRole", param);
        }

        public static void add(string userid, string roleid)
        {
            //先移除先有角色
            Hashtable del_sysuserrole = new Hashtable();
            del_sysuserrole["userid"] = userid;
            ERMapHelper.destroy("sysuserrole", del_sysuserrole);

            Hashtable sysuserrole = new Hashtable();
            sysuserrole["userid"] = userid;
            sysuserrole["roleid"] = roleid;
            ERMapHelper.setmodel("sysuserrole", "userid,roleid", sysuserrole);
        }
    }
}
